package com.pinganfu.mock.server;

import java.io.InputStream;  
import java.net.ServerSocket;  
import java.net.Socket;  
  
public class Server2 {  
  
    /** 
     * @param args 
     */  
    public static void main(String[] args) throws Exception {  
        ServerSocket socketServer = new ServerSocket(9090);  
        while (true) {  
            Socket socket = socketServer.accept();  
            InputStream in = socket.getInputStream();  
            byte[] b = new byte[7];  
            int len;  
            try {  
                while ((len = in.read(b)) != -1) {  
                    String value = new String(b, 0, len);  
                    double d=Double.parseDouble(value);  
                    
                    double d2=Double.parseDouble(value);  
                    //process data  
                    
                    System.out.println(d+","+d2);  
                }  
            } catch (Exception ex) {  
                //handle exception  
                ex.printStackTrace();  
            }  
        }  
    }  
  
}  